package com.lcy.web.base

import javax.ws.rs.Consumes
import javax.ws.rs.Produces
import javax.ws.rs.core.Response
import javax.ws.rs.ext.ExceptionMapper
import javax.ws.rs.ext.Provider

/**
 * 用于统一异常处理
 * Created by loucunyin on 6/25/17.
 */
@Provider
@Produces("*/*")
@Consumes("*/*")
class ExceptionHandler :ExceptionMapper<Exception>{
    override fun toResponse(exception: Exception): Response {
        exception.printStackTrace()
        return Response.ok(exception.message).build();
    }
}